let uu = document.querySelector('.uu')
let span = document.querySelector('span')
let foot = document.querySelector('.footer1>div>b:nth-of-type(3)')
let mar = document.querySelector('.mar')
let uuu = document.querySelector('.uuu')
let mars = document.querySelector('.mar>div>ul')
function getQueryString() {
    let url = location.href
    console.log(url)
    let reg = /(?<=\?).*/
    let r = url.match(reg)
    console.log(r)
    let rm = r[0]
    console.log(rm)
    fetch('http://chst.vip:1234/api/getcouponproduct?' + rm)
        .then(body => body.json())
        .then(res => {
            console.log(res)
            let _this = res.result
            console.log(_this)
            let domStr = ''
            let domStrImg = ''
            _this.forEach(item => {
                domStr += `<li>${item.couponProductImg}
            <p>${item.couponProductName}</p>
            <p>${item.couponProductPrice}</p>
            <b>${item.couponProductTime}</b>
            </li>`
                domStrImg += `<li>${item.couponProductImg}</li>`
            })
            mars.innerHTML = domStrImg
            uu.innerHTML = domStr
        })
}
getQueryString()
let page = 1
$('.btn1').click(function () {

    $('.uuu').css('transform', 'translateX(((-146.69)*page)rem)').animate()
    $('.uuu').animate().css('transition', 'all 0.7s')
})
$('.uu').on('click', 'img', function () {
    console.log(this)
    $(this).parent().parent().next().css('transform', 'translateY(0)')
    $(this).parent().parent().next().css('transition', 'all 0.7s')
})
$('.mar').on('click', 'b', function () {
    $(this).parent().parent().css('transform', 'translateY(-26.6667rem)')
    $(this).parent().parent().css('transition', 'all 0.7s')
})

span.onclick = function () {
    location.href = "./../html/youhuijuan.html"
}
foot.onclick = function () {
    location.href = "./../html/youhuijuan.html"
}